<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        ul {
            list-style: none;
            overflow: hidden;
        }

        li {
            float: left;
            width: 100px;
            height: 30px;
            border: 1px solid;
            font: 14px/30px '微软雅黑';
            text-align: center;
        }

        .img {
            width: 500px;
            height: 500px;
            border: 1px solid;
        }
        .active{
            background-color: yellow;
        }
    </style>
</head>

<body>
    <div id="app">
        <ul>
            <li v-for='(item,index) in list' @click='setInfo(index,$event)' :class="[currentIndex == index?'active':'']">{{item.title}}</li>
        </ul>
        <div class="img">
            {{msg}}
        </div>
    </div>
    <script src="../node_modules/vue/dist/vue.min.js"></script>
    <script>
        var vm = new Vue({
            el: '#app',
            data() {
                return {
                    currentIndex:0,
                    msg:'orange',
                    list: [
                        { id: 1, title: 'orange' },
                        { id: 2, title: 'apple' },
                        { id: 3, title: 'lemon' },
                    ]
                }
            },
            methods: {
                setInfo: function (index,e) {
                    this.currentIndex = index;
                    this.msg = e.target.innerHTML;
                }
            },
        })
    </script>
</body>

</html>